package com.oldking.utils;

import java.math.BigDecimal;

public class CommonUtil {

    public static long getLongPercent(long count, long total) {
        if(total==0){
            return 0;
        }
        BigDecimal currentCount = new BigDecimal(count);
        BigDecimal totalCount = new BigDecimal(total);
        BigDecimal divide = currentCount.divide(totalCount,2, BigDecimal.ROUND_HALF_UP);
        return divide.multiply(new BigDecimal(100)).longValue();
    }

}
